﻿using System.Collections.Generic;
using NanoERP.Model.Poco;

namespace NanoERP.Model.SystemMgmt
{
    public class DepartmentTree : SYS_Department, ITree<DepartmentTree>
    {
        private IList<DepartmentTree> _children;
        private IList<UserModel> _users;

        public DepartmentTree Parent { get; set; }

        public IList<UserModel> Users
        {
            get { return _users ?? (_users = new List<UserModel>()); }
        }

        public IList<DepartmentTree> Children
        {
            get { return _children ?? (_children = new List<DepartmentTree>()); }
        }

        public void AddToChildren(DepartmentTree newItem)
        {
            newItem.Parent = this;
            Children.Add(newItem);
        }

    }

}
